package v1ch05.arrayList;

import java.util.*;

/**
 * 该程序演示了ArrayList类。简单泛型示例
 *
 * @author Cay Horstmann
 * @version 1.11 2012-01-26
 */
public class ArrayListTest {
	public static void main(String[] args) {
		//用三个Employee对象填充人员数组列表
		ArrayList<Employee> staff = new ArrayList<>();
		
		staff.add(new Employee("Carl Cracker", 75000, 1987, 12, 15));
		staff.add(new Employee("Harry Hacker", 50000, 1989, 10, 1));
		staff.add(new Employee("Tony Tester", 40000, 1990, 3, 15));
		
		//将每个人的薪水提高5％
		for (Employee e : staff) {
			System.out.println(e.getName() + "提高前：" + e.getSalary());
			e.raiseSalary(5);
			System.out.println(e.getName() + "提高后：" + e.getSalary());
		}
		
		//打印有关所有Employee对象的信息
		for (Employee e : staff) {
			System.out.println(e.toString());
		}
	}
}